package com.design.controller;

import com.design.domain.form.LoginForm;
import com.design.domain.result.CommonResult;
import com.design.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
public class TokenController {

	@Autowired
	private ILoginService loginService;

	@PostMapping("/login")
	public CommonResult login(@RequestBody LoginForm loginForm) {
		return loginService.login(loginForm);
	}

	@PostMapping("/register")
	public CommonResult register(@RequestBody LoginForm loginForm) {
		return loginService.register(loginForm);
	}

}
